package io;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;

public class Test2 {
    public static void main(String[] args) {
        String path="D:\\javacode\\javacode\\J2025_2_5\\hello2.txt";

        BufferedInputStream bufferedInputStream=null;
        byte []buf =new byte[8];
        int read_len=0;
        try {
            bufferedInputStream=new BufferedInputStream(new FileInputStream(path));
            while((read_len=bufferedInputStream.read(buf))!=-1){
                System.out.println(new String(buf,0,read_len));
            }


        } catch (IOException e) {
            throw new RuntimeException(e);
        }finally {
            if(bufferedInputStream!=null){
                try {
                    bufferedInputStream.close();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
        }
    }
}
